import java.util.Scanner;



public class defconverter {

	public static void main(String[] args) {
		
		//String convertedString = DEFStringConverter.convert("he@LE123:45 text[(true){FALSE}] [$LOOP:FE(32){ABC}] @MATH(hi)@LE:12text2");	
		NewConverter newConverter = new NewConverter();
		//String defStringToConvert = "@PADR(12,\"@FMT(\"@MATH(\"((15 + 15) + (40/2))/5\")\",\"$###.00\")\",33)";  //this works!!! 
		//String defStringToConvert = "[(@AP:12=`A` AND @AP:13 > 1){hello hi @AP:12 @AP:13}]";  //this works!!! 
		//String defStringToConvert = "[$LOOP:DE(@DE$:13>5){hello}]";
		String defStringToConvert;
		if (args.length < 1) {
			System.out.println("Please enter the DEF command to convert to xsl as a command line argument or enter below:");
		    Scanner s = new Scanner(System.in);
			defStringToConvert = s.next();
			s.close();
		} else {
			defStringToConvert = args[0];
		}
		String convertedString = newConverter.convertWithFinalComponents(defStringToConvert); 
		System.out.println(convertedString);
		
		xslFileWriter wtxf = new xslFileWriter();
//		wtxf.writeToXSL("<!--- DEF STRING: " + defStringToConvert + " --->\n" + convertedString);
		wtxf.writeToXSL(convertedString);
	}

	

}

